package aash.catalog.views.menubar;

import aash.catalog.views.menu.MenuFile;
import aash.catalog.views.menu.MenuProject;
import java.awt.event.ActionListener;
import java.awt.event.MouseListener;
import javax.swing.JMenu;
import javax.swing.JMenuBar;

/**
 * MenuBar of the window "Explorer".
 * @author Aashintan
 */
public class MenuBarExplorer extends JMenuBar {
    /**
     * serialVersionUID.
     */
    private static final long serialVersionUID = -1231464449844823281L;
    /**
     * File menu.
     */
    private JMenu menuFile = new MenuFile();
    /**
     * File menu.
     */
    private JMenu menuProject = null;

    /**
     * Class constructor.
     * @param ml Mouselistener
     */
    public MenuBarExplorer(final ActionListener ml) {
        // addMouseListener(ml);
        menuProject = new MenuProject(ml);
        // this.add(menuFile);
        this.add(menuProject);
    }

    /**
     * Add Mouse Listener to the class and all of its sub-component.
     * @param ml MouseListener
     */
    public final void addMouseListener(final MouseListener ml) {
        // super.addMouseListener(ml);
        int i;
        for (i = 0; i < getMenuCount(); i++) {
            getMenu(i).addMouseListener(ml);
        }
    }
}
